#include "hcpp/ptp2_slave.h"

/**
 * Initialize a slave with its default values (0, LOG_PERIOD_DENIED, PORT_IDENTITY_ALL)
 *
 * @param[in]       this        reference to a slave
 * @param[in]       lut_entry   reference to the corresponding lut entry
 * @param[in]       address     reference to the corresponding node address
 * @param[in]       position    on what position in the list the slave resists
 */
void
ptp2_slave_init(ptp2_slave_t *this, ptp2_lut_entry_t *lut_entry, ptp2_node_address_t *address, uint16_t position)
{
    this->lut_entry                 = lut_entry;
    this->address                   = address;
    this->port_identity             = PTP2_PORT_IDENTITY_ALL;
    this->seq_id                    = 0;
    this->sync_log_period           = PTP2_SLAVE_LOG_PERIOD_DENIED;
    this->sync_duration             = 0;
    this->sync_expire               = 0;
    this->announce_log_period       = PTP2_SLAVE_LOG_PERIOD_DENIED;
    this->announce_duration         = 0;
    this->announce_expire           = 0;
    this->delay_response_log_period = PTP2_SLAVE_LOG_PERIOD_DENIED;
    this->delay_response_duration   = 0;
    this->delay_response_expire     = 0;
    this->position                  = position;
}

